﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FCS
{
    #region Perform<T>

    class Perform<T>
    {
        public Perform(FunAction<T> act, IFunList<T> list)
        {
            foreach (T val in list)
            {
                act(val);
            }
        }
    }

    #endregion

    #region Persist<T>

    class Persist<T> : IFunList<T>
    {
        private NonLazy<T> NonLazy { get; set; }

        public Persist(IFunList<T> list)
        {
            NonLazy = new NonLazy<T>();
            NonLazy.AddRange(list);
        }

        #region IEnumerable<T> Members

        public IEnumerator<T> GetEnumerator()
        {
            return NonLazy.GetEnumerator();
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.GetEnumerator();
        }

        #endregion
    }

    #endregion
}
